home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / GIMP 2.6.8 / gimp-2.6.8-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / glossy.scm < prev    next >
Text File  |  2009-12-15  |  12KB  |  296 lines

  1. ; glossy-patterned-shadowed-and-bump-mapped-logo
  2. ; creates anything you can create with it :)
  3. ; (use it wisely, use it in peace...)
  4. ;
  5. ; GIMP - The GNU Image Manipulation Program
  6. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  7. ;
  8. ; glossy gives a glossy outlook to your fonts (unlogical name, isn't it?)
  9. ; Copyright (C) 1998 Hrvoje Horvat
  10. ;
  11. ; This program is free software; you can redistribute it and/or modify
  12. ; it under the terms of the GNU General Public License as published by
  13. ; the Free Software Foundation; either version 2 of the License, or
  14. ; (at your option) any later version.
  15. ;
  16. ; This program is distributed in the hope that it will be useful,
  17. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. ; GNU General Public License for more details.
  20. ;
  21. ; You should have received a copy of the GNU General Public License
  22. ; along with this program; if not, write to the Free Software
  23. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25. (define (apply-glossy-logo-effect img
  26.                                   logo-layer
  27.                                   blend-gradient-text
  28.                                   blend-gradient-text-reverse
  29.                                   blend-gradient-outline
  30.                                   blend-gradient-outline-reverse
  31.                                   grow-size
  32.                                   bg-color
  33.                                   use-pattern-text
  34.                                   pattern-text
  35.                                   use-pattern-outline
  36.                                   pattern-outline
  37.                                   use-pattern-overlay
  38.                                   pattern-overlay
  39.                                   noninteractive
  40.                                   shadow-toggle
  41.                                   s-offset-x
  42.                                   s-offset-y)
  43.   (let* (
  44.         (width (car (gimp-drawable-width logo-layer)))
  45.         (height (car (gimp-drawable-height logo-layer)))
  46.         (posx (- (car (gimp-drawable-offsets logo-layer))))
  47.         (posy (- (cadr (gimp-drawable-offsets logo-layer))))
  48.         (bg-layer (car (gimp-layer-new img width height RGB-IMAGE "Background" 100 NORMAL-MODE)))
  49.         (grow-me (car (gimp-layer-copy logo-layer TRUE)))
  50.         (dont-drop-me 0)
  51.         )
  52.  
  53.     (gimp-context-push)
  54.  
  55.     (script-fu-util-image-resize-from-layer img logo-layer)
  56.     (script-fu-util-image-add-layers img grow-me bg-layer)
  57.     (gimp-drawable-set-name grow-me "Grow-me")
  58.     (gimp-layer-translate grow-me posx posy)
  59.  
  60.     (gimp-context-set-background bg-color)
  61.     (gimp-selection-all img)
  62.     (gimp-edit-bucket-fill bg-layer BG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  63.     (gimp-selection-none img)
  64.  
  65.     (gimp-selection-layer-alpha logo-layer)
  66.  
  67. ; if we are going to use transparent gradients for text, we will (maybe) need to uncomment this
  68. ; this clears black letters first so you don't end up with black where the transparent should be
  69. ;    (gimp-edit-clear img logo-layer)
  70.  
  71.     (if (= use-pattern-text TRUE)
  72.       (begin
  73.         (gimp-context-set-pattern pattern-text)
  74.         (gimp-edit-bucket-fill logo-layer
  75.                                PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  76.       )
  77.     )
  78.  
  79.     (if (= use-pattern-text FALSE)
  80.       (begin
  81.         (gimp-context-set-gradient blend-gradient-text)
  82.  
  83.         (gimp-edit-blend logo-layer CUSTOM-MODE NORMAL-MODE
  84.                          GRADIENT-LINEAR 100 0 REPEAT-NONE
  85.                          blend-gradient-text-reverse
  86.                          FALSE 0 0 TRUE
  87.                          0 0 0 (+ height 5))
  88.       )
  89.     )
  90.  
  91.     (gimp-selection-none img)
  92.  
  93.     (gimp-selection-layer-alpha grow-me)
  94.     (gimp-selection-grow img grow-size)
  95.  
  96. ; if we are going to use transparent gradients for outline, we will (maybe) need to uncomment this
  97. ; I didn't put it in the options because there are already enough settings there and anyway, transparent
  98. ; gradients will be used very rarely (if ever)
  99. ;    (gimp-edit-clear img grow-me)
  100.  
  101.     (if (= use-pattern-outline TRUE)
  102.       (begin
  103.         (gimp-context-set-pattern pattern-outline)
  104.         (gimp-edit-bucket-fill grow-me
  105.                                PATTERN-BUCKET-FILL NORMAL-MODE 100
  106.                                0 FALSE 0 0)
  107.       )
  108.     )
  109.  
  110.     (if (= use-pattern-outline FALSE)
  111.       (begin
  112.         (gimp-context-set-gradient blend-gradient-outline)
  113.  
  114.         (gimp-edit-blend grow-me CUSTOM-MODE NORMAL-MODE
  115.                          GRADIENT-LINEAR 100 0 REPEAT-NONE
  116.                          blend-gradient-outline-reverse
  117.                          FALSE 0 0 TRUE
  118.                          0 0 0 (+ height 5))
  119.       )
  120.     )
  121.  
  122.     (gimp-selection-none img)
  123.  
  124.     (plug-in-bump-map (if (= noninteractive TRUE)
  125.               RUN-NONINTERACTIVE
  126.               RUN-INTERACTIVE)
  127.               img grow-me logo-layer
  128.                       110.0 45.0 3 0 0 0 0 TRUE FALSE 0)
  129.     (gimp-layer-set-mode logo-layer SCREEN-MODE)
  130.  
  131.     (if (= use-pattern-overlay TRUE)
  132.       (begin
  133.         (gimp-selection-layer-alpha grow-me)
  134.         (gimp-context-set-pattern pattern-overlay)
  135.         (gimp-edit-bucket-fill grow-me PATTERN-BUCKET-FILL
  136.                                OVERLAY-MODE 100 0 FALSE 0 0)
  137.         (gimp-selection-none img)
  138.       )
  139.     )
  140.  
  141.     (if (= shadow-toggle TRUE)
  142.       (begin
  143.         (gimp-selection-layer-alpha logo-layer)
  144.         (set! dont-drop-me (car (script-fu-drop-shadow img logo-layer
  145.                                                        s-offset-x s-offset-y
  146.                                                        15 '(0 0 0) 80 TRUE)))
  147.         (set! width (car (gimp-image-width img)))
  148.         (set! height (car (gimp-image-height img)))
  149.         (gimp-selection-none img)
  150.       )
  151.     )
  152.  
  153.     (gimp-context-pop)
  154.   )
  155. )
  156.  
  157.  
  158. (define (script-fu-glossy-logo-alpha img
  159.                                      logo-layer
  160.                                      blend-gradient-text
  161.                                      blend-gradient-text-reverse
  162.                                      blend-gradient-outline
  163.                                      blend-gradient-outline-reverse
  164.                                      grow-size
  165.                                      bg-color
  166.                                      use-pattern-text
  167.                                      pattern-text
  168.                                      use-pattern-outline
  169.                                      pattern-outline
  170.                                      use-pattern-overlay
  171.                                      pattern-overlay
  172.                                      noninteractive
  173.                                      shadow-toggle
  174.                                      s-offset-x
  175.                                      s-offset-y)
  176.   (begin
  177.     (gimp-image-undo-group-start img)
  178.     (apply-glossy-logo-effect img logo-layer
  179.                               blend-gradient-text
  180.                               blend-gradient-text-reverse
  181.                               blend-gradient-outline
  182.                               blend-gradient-outline-reverse
  183.                               grow-size bg-color
  184.                               use-pattern-text pattern-text
  185.                               use-pattern-outline pattern-outline
  186.                               use-pattern-overlay pattern-overlay
  187.                               noninteractive shadow-toggle
  188.                               s-offset-x s-offset-y)
  189.     (gimp-image-undo-group-end img)
  190.     (gimp-displays-flush)
  191.   )
  192. )
  193.  
  194.  
  195. (script-fu-register "script-fu-glossy-logo-alpha"
  196.   _"Glo_ssy..."
  197.   _"Add gradients, patterns, shadows, and bump maps to the selected region (or alpha)"
  198.   "Hrvoje Horvat (hhorvat@open.hr)"
  199.   "Hrvoje Horvat"
  200.   "14/04/1998"
  201.   "RGBA"
  202.   SF-IMAGE      "Image"                     0
  203.   SF-DRAWABLE   "Drawable"                  0
  204.   SF-GRADIENT   _"Blend gradient (text)"    "Shadows 2"
  205.   SF-TOGGLE     _"Text gradient reverse"    FALSE
  206.   SF-GRADIENT   _"Blend gradient (outline)" "Shadows 2"
  207.   SF-TOGGLE     _"Outline gradient reverse" FALSE
  208.   SF-ADJUSTMENT _"Outline size"             '(5 0 250 1 10 0 1)
  209.   SF-COLOR      _"Background color"         "white"
  210.   SF-TOGGLE     _"Use pattern for text instead of gradient" FALSE
  211.   SF-PATTERN    _"Pattern (text)"           "Electric Blue"
  212.   SF-TOGGLE     _"Use pattern for outline instead of gradient" FALSE
  213.   SF-PATTERN    _"Pattern (outline)"        "Electric Blue"
  214.   SF-TOGGLE     _"Use pattern overlay"      FALSE
  215.   SF-PATTERN    _"Pattern (overlay)"        "Parque #1"
  216.   SF-TOGGLE     _"Default bumpmap settings" TRUE
  217.   SF-TOGGLE     _"Shadow"                   TRUE
  218.   SF-ADJUSTMENT _"Shadow X offset"          '(8 0 100 1 10 0 1)
  219.   SF-ADJUSTMENT _"Shadow Y offset"          '(8 0 100 1 10 0 1)
  220. )
  221.  
  222. (script-fu-menu-register "script-fu-glossy-logo-alpha"
  223.                          "<Image>/Filters/Alpha to Logo")
  224.  
  225.  
  226. (define (script-fu-glossy-logo text
  227.                                size
  228.                                font
  229.                                blend-gradient-text
  230.                                blend-gradient-text-reverse
  231.                                blend-gradient-outline
  232.                                blend-gradient-outline-reverse
  233.                                grow-size
  234.                                bg-color
  235.                                use-pattern-text
  236.                                pattern-text
  237.                                use-pattern-outline
  238.                                pattern-outline
  239.                                use-pattern-overlay
  240.                                pattern-overlay
  241.                                noninteractive
  242.                                shadow-toggle
  243.                                s-offset-x
  244.                                s-offset-y)
  245.   (let* (
  246.         (img (car (gimp-image-new 256 256 RGB)))
  247.         (text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font)))
  248.         )
  249.     (gimp-image-undo-disable img)
  250.     (apply-glossy-logo-effect img text-layer
  251.                               blend-gradient-text
  252.                               blend-gradient-text-reverse
  253.                               blend-gradient-outline
  254.                               blend-gradient-outline-reverse
  255.                               grow-size bg-color
  256.                               use-pattern-text pattern-text
  257.                               use-pattern-outline pattern-outline
  258.                               use-pattern-overlay pattern-overlay
  259.                               noninteractive shadow-toggle
  260.                               s-offset-x s-offset-y)
  261.     (gimp-image-undo-enable img)
  262.     (gimp-display-new img)
  263.   )
  264. )
  265.  
  266. (script-fu-register "script-fu-glossy-logo"
  267.   _"Glo_ssy..."
  268.   _"Create a logo with gradients, patterns, shadows, and bump maps"
  269.   "Hrvoje Horvat (hhorvat@open.hr)"
  270.   "Hrvoje Horvat"
  271.   "14/04/1998"
  272.   ""
  273.   SF-STRING     _"Text"                     "Galaxy"
  274.   SF-ADJUSTMENT _"Font size (pixels)"       '(100 2 1000 1 10 0 1)
  275.   SF-FONT       _"Font"                     "Eras"
  276.   SF-GRADIENT   _"Blend gradient (text)"    "Shadows 2"
  277.   SF-TOGGLE     _"Text gradient reverse"    FALSE
  278.   SF-GRADIENT   _"Blend gradient (outline)" "Shadows 2"
  279.   SF-TOGGLE     _"Outline gradient reverse" FALSE
  280.   SF-ADJUSTMENT _"Outline size"             '(5 0 250 1 10 0 1)
  281.   SF-COLOR      _"Background color"         "white"
  282.   SF-TOGGLE     _"Use pattern for text instead of gradient" FALSE
  283.   SF-PATTERN    _"Pattern (text)"           "Electric Blue"
  284.   SF-TOGGLE     _"Use pattern for outline instead of gradient" FALSE
  285.   SF-PATTERN    _"Pattern (outline)"        "Electric Blue"
  286.   SF-TOGGLE     _"Use pattern overlay"      FALSE
  287.   SF-PATTERN    _"Pattern (overlay)"        "Parque #1"
  288.   SF-TOGGLE     _"Default bumpmap settings" TRUE
  289.   SF-TOGGLE     _"Shadow"                   TRUE
  290.   SF-ADJUSTMENT _"Shadow X offset"          '(8 0 100 1 10 0 1)
  291.   SF-ADJUSTMENT _"Shadow Y offset"          '(8 0 100 1 10 0 1)
  292. )
  293.  
  294. (script-fu-menu-register "script-fu-glossy-logo"
  295.                          "<Image>/File/Create/Logos")
  296.